<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../../../layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="../../../../layuiadmin/style/admin.css" media="all">
		<link rel="stylesheet" href="../../../../css/common.css" media="all">

	</head>
	<body>

		<div class="layui-fluid">
			<div class="layui-row" id="view">
				<form class="layui-form"   lay-filter="test_detail">
					<div class="layui-card">
						<div class="layui-card-body"> 
							 
							<div class="layui-form-item">
								<label class="layui-form-label">用户号：</label>
								<div class="layui-input-block">
									<input type="text" name="userNo" placeholder="请输入用户号" autocomplete="off" class="layui-input">
								</div>
							</div>
							
							<div class="layui-form-item">
								<label class="layui-form-label">地址Id：</label>
								<div class="layui-input-block">
									<input type="text" name="addrId" placeholder="请输入地址Id" autocomplete="off" class="layui-input">
								</div>
							</div>
							
							<div class="layui-form-item">
								<label class="layui-form-label">地址描述：</label>
								<div class="layui-input-block">
									<input type="text" name="addrDes" placeholder="请输入地址描述" autocomplete="off" class="layui-input">
								</div>
							</div>
							
							<div class="layui-form-item">
								<label class="layui-form-label">表具id：</label>
								<div class="layui-input-block">
									<input type="text" name="meterId" placeholder="请输入表具id" autocomplete="off" class="layui-input">
								</div>
							</div>
							
							<div class="layui-form-item">
								<label class="layui-form-label">联系人：</label>
								<div class="layui-input-block">
									<input type="text" name="contractor" placeholder="请输入联系人" autocomplete="off" class="layui-input">
								</div>
							</div>
							
							<div class="layui-form-item">
								<div class="layui-inline">
									<label class="layui-form-label">联系电话·：</label>
									<div class="layui-input-block">
										<input type="text" name="contractPhone" placeholder="请输入联系电话·" autocomplete="off" class="layui-input">
									</div>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label">备用电话：</label>
									<div class="layui-input-block">
										<input type="text" name="sparePhone" placeholder="请输入备用电话" autocomplete="off" class="layui-input">
									</div>
								</div>
							</div>
							
							
							 
  							<div class="layui-form-item">
								<label class="layui-form-label">备注：</label>
								<div class="layui-input-block">
									<textarea class="layui-textarea " name="remark" lay-verify="remark"></textarea>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">问题描述：</label>
								<div class="layui-input-block">
									<textarea class="layui-textarea " name="content" lay-verify="content" ></textarea>
								</div>
							</div> 
  
							<div class="layui-form-item">
							 	<div class="layui-inline">
							      <label class="layui-form-label">预约时间</label>
							      <div class="layui-input-inline">
							        <input type="text" name="preTime" class="layui-input" id="test5" placeholder="yyyy-MM-dd HH:mm:ss">
							      </div>
							    </div>
							</div>  
							
							<div class="layui-form-item">
								<div class="layui-inline">
									<label class="layui-form-label">工单类型：</label>
									<div class="layui-input-inline">
										<select class="layui-input-inline woType" name="woType">
											<option value="1" title="维修工单">维修工单</option>
											<option value="2" title="勘察工单">勘察工单</option>
											<option value="4" title="通气点火工单">通气点火工单</option>
											<option value="7" title="咨询工单">咨询工单</option>
											<option value="8" title="投诉工单">投诉工单</option>
											<option value="10" title="安装工单">安装工单</option>
										</select>
									</div>
								</div>
								<div class="layui-inline">
									<label class="layui-form-label">紧急程度：</label>
									<div class="layui-input-inline">
										<select class="layui-input-inline priorityLevel" name="priorityLevel">
											<option value="1" title="正常">正常</option>
											<option value="2" title="紧急">紧急</option>
											<option value="3" title="十分紧急">十分紧急</option> 
										</select>
									</div>
								</div>
							</div>
	   
							<div class="layui-form-item">
								<label class="layui-form-label">坐席员工id：</label>
								<div class="layui-input-block">
									<input type="text" name="staffId" placeholder="请输入坐席员工id" autocomplete="off" class="layui-input">
								</div>
							</div>
	  						
							
							<div class="layui-form-item">
								<label class="layui-form-label">咨询问题ID：</label>
								 
								<div class="layui-input-inline">
									<select class="layui-input-inline ptId" name="ptId">
										<option value="1" title="费用咨询">费用咨询</option>
										<option value="2" title="设备咨询">设备咨询</option>
									</select>
								</div>
							</div> 
							
							<div class="layui-form-item">
								<label class="layui-form-label">回复内容：</label>
								<div class="layui-input-block">
									<textarea placeholder="请输入回复内容" name="replyDes" class="layui-textarea"></textarea>
								</div>
							</div> 
							
							<div class="layui-form-item">
								<label class="layui-form-label">投诉部门id：</label>
								<div class="layui-input-block">
									<input type="text" name="complaintDept" placeholder="请输入投诉部门id" autocomplete="off" class="layui-input">
								</div>
							</div>
							 
							<div class="layui-form-item">
								<label class="layui-form-label">投诉员工id：</label>
								<div class="layui-input-block">
									<input type="text" name="complaintStaff" placeholder="请输入投诉员工id" autocomplete="off" class="layui-input">
								</div>
							</div> 
							 
						</div>
					</div>

					<div class="layui-form-item layui-layout-admin">
						<div class="layui-input-block">
							<div class="layui-footer" style="left: 0;">
								<!-- <button type="reset" class="layui-btn layui-btn-primary">重置</button> -->
								<button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
		<script src="../../../../layuiadmin/layui/layui.js"></script>
		<script src="../../../../js/jquery.min.js"></script>
		<script src="../../../../js/jquery.jqprint-0.3.js"></script>
		<script src="../../../../js/ace/ace.js"></script>
		<script src="../../../../js/common.js"></script>
		<!--<script src="https://raw.githack.com/hnzzmsf/layui-formSelects/master/dist/formSelects-v4.min.js" type="text/javascript" charset="utf-8"></script>-->
		<script src="../../../../layuiadmin/modules/formSelects-v4.js"></script>
		<script>
			var _data = { 
				id: getParam('id'), 
			}

			var request_data = []
			 
			layui.config({
				base: '../../../../layuiadmin/' //静态资源所在路径
			}).extend({
				tinymce: '../tinymce/tinymce',
				index: 'lib/index' //主入口模块
			}).use(['index', 'form', 'laytpl', 'laydate', 'layedit', 'upload','tinymce','util'], function() {
				var $ = layui.$,
					admin = layui.admin,
					upload = layui.upload,
					laytpl = layui.laytpl,
					laydate = layui.laydate,  
					tinymce = layui.tinymce,
					form = layui.form;
					//日期时间选择器
				  laydate.render({
				    elem: '#test5'
				    ,type: 'datetime'
				  });   
				var edit = tinymce.render({
					elem: "#demo_editor",
					height: 600
				});
				 
				if(_data.id){
					initdata(); 
				}

				//监听提交
				form.on('submit(demo1)', function(data) { 
					var data = data.field;
					_data = Object.assign(_data, data);  
//					_data.content = edit.getContent(); 
					layer.confirm('确定要提交数据？', function() {
						loading();
						if (_data.id) {
							submitdata(server.sys_work_order_edit);
						} else {
							submitdata(server.sys_work_order_insert);
						}
					}, function() {
						layer.msg('取消操作');
					});
					return false;
				});
					
				function submitdata(_url) {
					$.post(_url, _data, function(res, status) {
						if (status == 'success') {
							if (res.code == 0) {
								layer.alert('操作成功', function() {
									parent.layer.closeAll();
									parent.layui.table.reload('test-table-operate');
								});
							} else {
								closeloading();
								layer.msg(res.msg);
							}
						} else {
							layer.msg('服务器连接错误');
						}
					});
				}
					
				  
				function initdata() {
					$.get(server.sys_work_order_detail, _data, function(res, status) {
						if (status == 'success') {
							if (res.code == 0) {
								var data = res.work_order 
								form.val("test_detail", data.data);
								form.render();
//								edit.setContent(data.data.content) 
							} else {
								layer.msg(res.msg);
							}
						} else {
							layer.msg('服务器连接错误');
						}
					});
				} 
				
			});
			
		</script>
	</body>
</html>
